#pragma once

namespace DXBase
{
	namespace Loader
	{
#ifndef D3DCOLOR_DEFINED
#define D3DCOLOR_DEFINED

// this will also match DXBase.color32 / DXGI_FORMAT_B8G8R8A8_UNORM
typedef DWORD D3DCOLOR;

#define D3DCOLOR_ARGB(a,r,g,b) \
    ((D3DCOLOR)((((a)&0xff)<<24)|(((r)&0xff)<<16)|(((g)&0xff)<<8)|((b)&0xff)))
#define D3DCOLOR_RGBA(r,g,b,a) D3DCOLOR_ARGB(a,r,g,b)
#define D3DCOLOR_XRGB(r,g,b)   D3DCOLOR_ARGB(0xff,r,g,b)

#define D3DCOLOR_XYUV(y,u,v)   D3DCOLOR_ARGB(0xff,y,u,v)
#define D3DCOLOR_AYUV(a,y,u,v) D3DCOLOR_ARGB(a,y,u,v)

// maps floating point channels (0.f to 1.f range) to D3DCOLOR
#define D3DCOLOR_COLORVALUE(r,g,b,a) \
    D3DCOLOR_RGBA((DWORD)((r)*255.f),(DWORD)((g)*255.f),(DWORD)((b)*255.f),(DWORD)((a)*255.f))

#endif


		//---------------------------------------------------------------
		// default vertex data structure
		// (even if tangents, bitangents or normals aren't
		// required by the shader they will be committed to the GPU)
		// 
		// => Mapped by DXBase.ModelVertex in DBase.Utils\Structs\ModelShaderStructs
		//---------------------------------------------------------------
		struct Vertex
		{
			aiVector3D vPosition;
			aiVector3D vNormal;
			D3DCOLOR dColorDiffuse;
			aiVector3D vTangent;
			aiVector3D vBitangent;
			aiVector2D vTextureUV;
			aiVector2D vTextureUV2;
			unsigned char mBoneIndices[4];
			unsigned char mBoneWeights[4]; // last Weight not used, calculated inside the vertex shader
		};

		//---------------------------------------------------------------
		// FVF vertex structure used for normals
		//---------------------------------------------------------------
		struct LineVertex
		{
			aiVector3D vPosition;
			D3DCOLOR dColorDiffuse;
		};
	}
}